<template>
  <div class="dashboard-container">
    <!-- 顶部导航栏 -->
    <header class="top-header">
      <div class="header-left">
        <h1>数据可视化平台</h1>
      </div>
      <nav class="header-middle">
        <router-link to="/matplotlib" class="nav-item">matplotlib可视化</router-link>
        <router-link to="/seaborn" class="nav-item">seaborn可视化</router-link>
        <router-link to="/pyecharts" class="nav-item">pyecharts可视化</router-link>
      </nav>
      <div class="header-right">
        <span class="time-display">{{ currentTime }}</span>
        <div class="user-info">
          <div class="user-avatar">
            <img src="../assets/tx.jpg" alt="用户头像">
          </div>
          <span class="user-name">{{ userInfo.name }}</span>
        </div>
      </div>
    </header>
    <!-- 可视化图容器 - 左右布局 -->
    <div class="visualization-area">
      <!-- 左侧 - 矩阵散点图 -->
      <div class="left-section">
        <div class="visualization-box large-box">
          <h3 class="chart-title">矩阵散点图 - 多变量关系可视化</h3>
          <img src="../assets/矩阵散点图.png" alt="矩阵散点图" class="seaborn-image">
        </div>
      </div>
      <!-- 右侧 - 统计直方图与密度估计图叠加 -->
      <div class="right-section">
        <div class="visualization-box large-box">
          <h3 class="chart-title">统计直方图与密度估计图叠加 - 分布分析</h3>
          <img src="../assets/直方图与密度估计图.png" alt="统计直方图与密度估计图叠加" class="seaborn-image">
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref, onMounted, reactive } from 'vue';

// 当前时间
const currentTime = ref(new Date().toLocaleString());

// 用户信息，默认已登录状态
const userInfo = reactive({
  name: 'Admin',
  role: '管理员',
  department: '数据分析部',
  avatar: 'https://secure.gravatar.com/avatar/00000000000000000000000000000000?d=mp&f=y'
});

// 实时更新时间
onMounted(() => {
  const timer = setInterval(() => {
    currentTime.value = new Date().toLocaleString();
  }, 1000);

  return () => clearInterval(timer);
});
</script>

<style scoped>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&display=swap');

/* 全局重置样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.dashboard-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #0a0e17;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(37, 93, 217, 0.1) 0%, transparent 80%),
    linear-gradient(to bottom, rgba(0, 30, 60, 0.4) 0%, transparent 100%),
    repeating-linear-gradient(to right, transparent, transparent 50px, rgba(6, 78, 144, 0.05) 50px, rgba(6, 78, 144, 0.05) 51px),
    repeating-linear-gradient(to bottom, transparent, transparent 50px, rgba(6, 78, 144, 0.05) 50px, rgba(6, 78, 144, 0.05) 51px);
  color: #e0f7ff;
  font-family: 'Orbitron', sans-serif;
  overflow: hidden;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: rgba(16, 24, 39, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 195, 255, 0.3);
  box-shadow: 0 0 20px rgba(0, 195, 255, 0.2);
  color: #e0f7ff;
  width: 100%;
  flex-shrink: 0;
  z-index: 10;
}

.header-left h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #00c3ff, #60efff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 10px rgba(0, 195, 255, 0.5);
}

.header-middle {
  display: flex;
  gap: 30px;
}

.nav-item {
  color: #e0f7ff;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  padding: 5px 10px;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.nav-item:hover {
  color: #60efff;
  text-shadow: 0 0 10px rgba(0, 195, 255, 0.8);
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #00c3ff, transparent);
  transition: width 0.3s ease;
}

.nav-item:hover::after {
  width: 100%;
}

.header-right {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  align-items: center;
}

.time-display {
  background-color: rgba(0, 30, 60, 0.5);
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 195, 255, 0.3);
  box-shadow: 0 0 5px rgba(0, 195, 255, 0.2);
}

/* 用户信息样式 */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: rgba(0, 30, 60, 0.5);
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid rgba(0, 195, 255, 0.3);
  box-shadow: 0 0 5px rgba(0, 195, 255, 0.2);
  transition: all 0.3s ease;
}

.user-info:hover {
  box-shadow: 0 0 10px rgba(0, 195, 255, 0.4);
  border-color: rgba(0, 195, 255, 0.5);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(0, 195, 255, 0.5);
  box-shadow: 0 0 8px rgba(0, 195, 255, 0.4);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  font-weight: 500;
  letter-spacing: 1px;
  color: #60efff;
  text-shadow: 0 0 5px rgba(0, 195, 255, 0.5);
}

/* 修改为左右布局 */
.visualization-area {
  display: flex;
  flex: 1;
  width: 100%;
  padding: 20px;
  gap: 20px;
  position: relative;
  overflow: auto; /* 添加滚动条以防内容溢出 */
}

.visualization-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(37, 93, 217, 0.15) 0%, transparent 70%),
    radial-gradient(circle at 80% 70%, rgba(37, 93, 217, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* 左右两部分布局 */
.left-section,
.right-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.visualization-box {
  flex: 1;
  border: 1px solid rgba(0, 195, 255, 0.3);
  background-color: rgba(16, 24, 39, 0.7);
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 195, 255, 0.2);
  min-height: 500px; /* 增加高度以适应图片 */
  padding: 15px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.visualization-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 20px rgba(0, 195, 255, 0.4);
  border-color: rgba(0, 195, 255, 0.6);
}

.visualization-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, #00c3ff, transparent);
}

.visualization-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(135deg, rgba(0, 195, 255, 0.1) 0%, transparent 100%),
    repeating-linear-gradient(to right, transparent, transparent 30px, rgba(6, 78, 144, 0.03) 30px, rgba(6, 78, 144, 0.03) 31px),
    repeating-linear-gradient(to bottom, transparent, transparent 30px, rgba(6, 78, 144, 0.03) 30px, rgba(6, 78, 144, 0.03) 31px);
  pointer-events: none;
  z-index: -1;
}

.large-box {
  min-height: 500px;
  height: 100%;
}

/* 添加图片样式 */
.seaborn-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 85%;
  object-fit: contain;
  margin: auto;
  display: block;
  flex: 1;
}

/* 添加图表标题样式 */
.chart-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 15px;
  color: #60efff;
  text-shadow: 0 0 8px rgba(0, 195, 255, 0.6);
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(0, 195, 255, 0.3);
  padding-bottom: 8px;
  position: relative;
}

.chart-title::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 50px;
  height: 2px;
  background: linear-gradient(90deg, #00c3ff, transparent);
}

/* 添加动画效果 */
@keyframes pulse {
  0% { box-shadow: 0 0 15px rgba(0, 195, 255, 0.2); }
  50% { box-shadow: 0 0 20px rgba(0, 195, 255, 0.4); }
  100% { box-shadow: 0 0 15px rgba(0, 195, 255, 0.2); }
}

.visualization-box {
  animation: pulse 4s infinite ease-in-out;
}

/* 错开动画时间 */
.left-section .visualization-box { animation-delay: 0s; }
.right-section .visualization-box { animation-delay: 1.5s; }

/* 响应式调整 */
@media (max-width: 1100px) {
  .visualization-area {
    flex-direction: column;
    height: auto;
  }
  
  .left-section,
  .right-section {
    width: 100%;
    margin-bottom: 20px;
  }
  
  .visualization-box {
    min-height: 400px;
  }
}
</style>